package quick.frame.core.app;

import android.content.Context;
import android.os.Handler;

import com.elvishew.xlog.LogConfiguration;
import com.elvishew.xlog.LogLevel;
import com.elvishew.xlog.XLog;
import com.elvishew.xlog.flattener.DefaultFlattener;
import com.elvishew.xlog.printer.AndroidPrinter;
import com.elvishew.xlog.printer.ConsolePrinter;
import com.elvishew.xlog.printer.Printer;
import com.elvishew.xlog.printer.file.FilePrinter;
import com.elvishew.xlog.printer.file.backup.NeverBackupStrategy;
import com.elvishew.xlog.printer.file.naming.DateFileNameGenerator;

import quick.frame.core.util.file.FileUtil;

/**
 * Created by
 */

public final class Quick {

    public static Configurator init(Context context) {
        Configurator.getInstance()
                .getQuickConfigs()
                .put(ConfigKeys.APPLICATION_CONTEXT, context.getApplicationContext());
        //OkGo.getInstance().init(this);
        return Configurator.getInstance();
    }

    public static Configurator getConfigurator() {
        return Configurator.getInstance();
    }

    public static <T> T getConfiguration(Object key) {
        T t;
        try {
             t = getConfigurator().getConfiguration(key);
        } catch (Exception e) {
            XLog.e("获取配置信息出错",e);
            return null;
        }

        return  t;
    }

    public static Context getApplicationContext() {
        return getConfiguration(ConfigKeys.APPLICATION_CONTEXT);
    }

    public static Handler getHandler() {
        return getConfiguration(ConfigKeys.HANDLER);
    }

    public static void test(){
    }
}